<?php

namespace DEV\SISBundle\Form;

use DEV\SISBundle\Repository\TiposIvaRepository;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\OptionsResolver\OptionsResolverInterface;

class ClientesType extends AbstractType
{
    public function buildForm(FormBuilderInterface $builder, array $options)
    {
        $builder
            ->add('apenom',null,array('label'=>'Apellido y Nombre:'))
            ->add('cuit',null,array('label'=>'Cuit: ','required'=>false))
            ->add('telefono','text',array('label'=>'Teléfono: '))
            ->add('direccion','text',array('label'=>'Dirección: '))
            ->add('email','text',array('label'=>'E-Mail: '))
            ->add('tipoIva',null,array('label'=>'IVA: ','empty_value'=>false,
                    'query_builder' => function(TiposIvaRepository $er)
                    { return $er->createQueryBuilder('r')
                                ->orderBy('r.tipos','ASC');}))
            
        ;
    }

    public function setDefaultOptions(OptionsResolverInterface $resolver)
    {
        $resolver->setDefaults(array(
            'data_class' => 'DEV\SISBundle\Entity\Clientes'
        ));
    }

    public function getName()
    {
        return 'dev_sisbundle_clientestype';
    }
}
